﻿@{
    Layout = null;
}

<!doctype html>
<html>
<head>
    <title>Eminent Login Form Flat Responsive widget Template :: xmoban.cn</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Eminent Login Form Widget Responsive, Login form web template,Flat Pricing tables,Flat Drop downs  Sign up Web Templates, Flat Web Templates, Login signup Responsive web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <!-- font files -->
    <!--<link href='//fonts.googleapis.com/css?family=Raleway:400,100,200,300,500,600,700,800,900' rel='stylesheet' type='text/css'>-->
    <!--<link href='//fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>-->
    <!-- /font files -->
    <!-- css files -->
    <link href="../../Content/css/style.css" rel="stylesheet" type='text/css' media="all" />
    <!-- /css files -->
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script src="~/JSCookie.js"></script>
    <script>
        $(function () {

        })
        function login() {
            var uname = $("#txtuname").val();
            var upwd = $("#txtupwd").val();
            $.ajax({
                url: "http://localhost:13936/actionapi/values/login",
                type: "get",
                data: { uname: uname, upwd: upwd },
                success: function (s) {
                    if (s > 0) {
                        alert("登陆成功");
                        if (!window.localStorage) {
                            alert("浏览器不支持localStorage");
                            return false;
                        }
                        else {
                            var storage = window.localStorage;
                            storage.setItem("uname", uname);
                            location.href = "/home/index";
                        }
                    }
                    else {
                        alert("登录失败");
                    }
                }
            })
        }
        function regist() {
            var uname = $("#txtname").val();
            var upwd = $("#txtpwd").val();
            var spwd = $("#txtspwd").val();
            var ucard = $("#txtcard").val();
            $.ajax({
                url: "http://localhost:13936/actionapi/values/isregist",
                type: "get",
                data: { uname: uname },
                dataType: "json",
                success: function (s) {
                    if (s > 0) {
                        alert("用户已存在");
                    }
                    else {
                        if (upwd != spwd) {
                            alert("两次密码输入不一致");
                            return;
                        }
                        $.ajax({
                            url: "http://localhost:13936/actionapi/values/regist",
                            type: "post",
                            data: { uname: uname, upwd: upwd, ucard: ucard },
                            success: function (s2) {
                                if (s2 > 0) {
                                    alert("注册成功");
                                }
                                else {
                                    alert("注册失败");
                                }
                            }
                        })
                    }
                }
            })
        }
    </script>
</head>
<body>
    <h1>Eminent Login Form</h1>
    <div class="form-w3ls">
        <ul class="tab-group cl-effect-4">
            <li class="tab active"><a href="#signin-agile">Sign In</a></li>
            <li class="tab"><a href="#signup-agile">Join Us</a></li>
        </ul>
        <div class="tab-content">
            <div id="signin-agile">
                <form action="#" method="post">

                    <p class="header">User Name</p>
                    <input type="text" id="txtuname" name="user" value="User Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'User Name';}">

                    <p class="header">Password</p>
                    <input type="password" id="txtupwd" name="password" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">

                    <input type="checkbox" id="brand" value="">
                    <label for="brand"><span></span> Remember me?</label>

                    <input type="button" class="sign-in" value="Sign In" onclick="login()">

                    <ul class="links">
                        <li class="pass-w3ls"><a href="#">Forgot Password</a></li>
                    </ul>
                </form>
            </div>
            <div id="signup-agile">
                <form action="#" method="post">

                    <p class="header">User Name</p>
                    <input type="text" name="user" id="txtname" value="Your Full Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Full Name';}">

                    <p class="header">Card</p>
                    <input type="text" name="card" value="Your Card" id="txtcard" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Card ';}">

                    <p class="header">Password</p>
                    <input type="password" name="password" id="txtpwd" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">

                    <p class="header">Confirm Password</p>
                    <input type="password" name="password" id="txtspwd" value="Confirm Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Confirm Password';}">

                    <input type="button" class="register" value="Register" onclick="regist()">
                </form>
            </div>
        </div><!-- tab-content -->
    </div> <!-- /form -->
    <p class="copyright">© 2017 Eminent Login Form. All Rights Reserved | Design by mycodes.net</p>
    <!-- js files -->
    <script src="../../Content/js/jquery.min.js"></script>
    <script src="../../Content/js/index.js"></script>
    <!-- /js files -->
</body>
</html>
